close all;
clear;


%% exercise 03a multi image denoise filter (cups)
img00 = my_loadImage('cup/1.png');
img01 = my_loadImage('cup/2.png');
img02 = my_loadImage('cup/3.png');
img03 = my_loadImage('cup/4.png');
img04 = my_loadImage('cup/5.png');

cimg = my_nFilter(img00,img01,img02,img03,img04);

figure;
imshow(cimg);

%% exercise 03b multi image denoise filter (tree)
img10 = my_loadImage('tree/6.jpg');
img11 = my_loadImage('tree/7.jpg');
img12 = my_loadImage('tree/8.jpg');
img13 = my_loadImage('tree/9.jpg');
img14 = my_loadImage('tree/10.jpg');

timg = my_nFilter(img10,img11,img12,img13,img14);

figure;
imshow(timg);

%% Results discussion
% The algorithm here applied is a simple linear filter. We decided to use a
% 5x5 kernel mask with equal weights in every cell: 1/25
% We applied this mask to the image following the algorithm below:
%   - Move the center of the kernel mask to the desired pixel
%   - Multiply the kernel value to each neighbor inside the mask
%   - Add all the values together
%   - Substitute the pixel value to the average value obtained above
%   - Move to the next pixel and repeat the process
%
% On the first set of images (cups), this algorithm took ca. 2 minutes to
% process all the images and produced a fairly good denoised image. They
% are a bit blurry - lost the sharp edges and a bit of detail - but still
% recognizable
% The second set of images (tree) had a little bit more problems after the
% filter was applied. Since it contains lots of edges and nuances between
% leaves and twigs, the resulted blurry image compromises the overall look.
